package com.example.springmapstructsample;


import com.example.springmapstructsample.bean.Car;
import com.example.springmapstructsample.bean.User;
import com.example.springmapstructsample.dto.CarDto;
import com.example.springmapstructsample.dto.UserDto;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping
@RestController
public class TestController {

    @RequestMapping(value = {"test"}, method = {RequestMethod.GET})
    public UserDto test() {
        User user = new User("李白",12);
        return BeanToDtoConverter.INSTANCE.userToUserDto(user);
    }

    @RequestMapping(value = {"test1"},method = {RequestMethod.GET})
    public CarDto test1(){
        Car car= new Car("比亚迪汗");
        return BeanToDtoConverter.INSTANCE.carToCarDto(car);
    }
}
